home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / term / regis.trm < prev    next >
Text File  |  1993-09-17  |  4KB  |  187 lines

  1. /*
  2.  * $Id: regis.trm%v 3.38.2.122 1993/04/30 00:31:45 woo Exp woo $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - regis.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  REGIS devices
  26.  *
  27.  * AUTHORS
  28.  *  Colin Kelley, Thomas Williams
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33.  
  34. #define REGISXMAX 800             
  35. #define REGISYMAX 440
  36.  
  37. #define REGISXLAST (REGISXMAX - 1)
  38. #define REGISYLAST (REGISYMAX - 1)
  39.  
  40. #define REGISVCHAR        20      
  41. #define REGISHCHAR        9
  42. #define REGISVTIC        8
  43. #define REGISHTIC        6
  44.  
  45. #define TRUE 1
  46. #define FALSE 0
  47. static int REGIS16color=FALSE;
  48.  
  49. int REGISang = 0;
  50.  
  51. REGISinit()
  52. {
  53.     fprintf(outfile,"\033[r\033[24;1H");
  54. /*                   1     2
  55.     1. reset scrolling region
  56.     2. locate cursor on bottom line
  57. */
  58. }
  59.  
  60.  
  61. /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
  62. REGISgraphics()
  63. {
  64.     fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
  65. /*                   1      2      3    4   5
  66.     1. clear screen
  67.     2. enter ReGIS graphics
  68.     3. turn off graphics diamond cursor
  69.     4. clear graphics screen
  70. */
  71.     (void) REGIStext_angle(0); /* select text size and angle */ 
  72. }
  73.  
  74.  
  75. REGIStext()
  76. {
  77.     fprintf(outfile,"\033\\\033[24;1H");
  78. /*                       1    2
  79.     1. Leave ReGIS graphics mode
  80.      2. locate cursor on last line of screen
  81. */
  82. }
  83.  
  84.  
  85. REGISlinetype(linetype)
  86. int     linetype;
  87. {
  88.       /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
  89.  
  90. static int in_16_map[15+2] = {7,7,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  91. static int lt_16_map[15+2] = {1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
  92. static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
  93. static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
  94.    
  95.        if(!REGIS16color)
  96.        {    if (linetype >= 9)
  97.                linetype %= 9;
  98.            fprintf(outfile, "W(I%d)\n", in_map[linetype + 2]);
  99.            fprintf(outfile, "W(P%d)\n", lt_map[linetype + 2]);
  100.        }
  101.        else
  102.        {    if(linetype >=15)
  103.                linetype %= 15;
  104.            fprintf(outfile, "W(I%d)\n", in_16_map[linetype + 2]);
  105.            fprintf(outfile, "W(P%d)\n", lt_16_map[linetype + 2]);
  106.        }
  107. }
  108.  
  109.  
  110.  
  111. /*
  112. ** The \n was added in the functions below (and above) in order to not cause
  113. ** a buffer overflow in devices that can't deal with long line lengths.
  114. ** The DEC vt-340 doesn't need this, but Reflection 4, a vt-340 emulator
  115. ** for PC's under MS-DOS and Microsoft Windows does need it.
  116. ** Also needed for DECterm, a vt-340 emulator for use with Motif 1.0
  117. ** on Open/VMS.
  118. ** NGB 9/13/93
  119. */
  120.  
  121. REGISmove(x,y)
  122. int x,y;
  123. {
  124.     fprintf(outfile,"P[%d,%d]\n",x,REGISYLAST-y,x,REGISYLAST-y);
  125. }
  126.  
  127.  
  128. REGISvector(x,y)
  129. int x,y;
  130. {
  131.     fprintf(outfile,"v[]v[%d,%d]\n",x,REGISYLAST - y);
  132. /* the initial v[] is needed to get the first pixel plotted */
  133. }
  134.  
  135.  
  136. /* put_text and text_angle by rjl */
  137. REGISput_text(x,y,str)
  138. int x, y;
  139. char *str;
  140. {
  141.     if (REGISang==1)
  142.         REGISmove(x-REGISVCHAR/2-1,y);
  143.     else
  144.         REGISmove(x,y+REGISVCHAR/2-1);
  145.     (void) putc('T',outfile); (void) putc('\'',outfile);
  146.     while (*str) {
  147.         (void) putc(*str,outfile);
  148.         if (*str == '\'')
  149.             (void) putc('\'',outfile);    /* send out another one */
  150.         str++;
  151.     }
  152.     (void) putc('\'',outfile);
  153.     (void) putc('\n',outfile);
  154. }
  155.  
  156.  
  157. int REGIStext_angle(ang)
  158. int ang;
  159. {
  160.     REGISang = ang;
  161.     if (ang == 1)
  162.         fputs("T(D90,S1)\n",outfile);
  163.     else
  164.         fputs("T(D0,S1)\n",outfile);
  165.     return TRUE;
  166. }
  167.  
  168.  
  169. REGISreset()
  170. {
  171.     fprintf(outfile,"\033[2J\033[24;1H");
  172. }
  173.  
  174. REGISoptions()
  175. {    int i=0;
  176.        struct value a;
  177.        extern struct value *const_express();
  178.        extern double real();
  179.    
  180.        if(!END_OF_COMMAND)
  181.        {    i=(int)real(const_express(&a));
  182.        }
  183.        REGIS16color= (i==16);
  184.        sprintf(term_options,"%s",REGIS16color?"16":"4");
  185. }
  186.  
  187.